
<!-- <!doctype html> -->
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="css/date/calendar.css">
    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/default.css"/>
    <link rel="stylesheet" href="css/index.css"/>
</head>
<body style="width: 100%;height: 100%;">
<div id="scenicbody" class="scenicbody">
</div>
<div id="bar" class="am-navbar am-u-sm-12">
    <div class="am-fl am-u-sm-4 am-text-center bottom-all">
        <div id="bar" class="am-navbar am-u-sm-12 bottom-box">
            <div class="am-fl am-u-sm-4 am-text-center bottom-all" onclick="MAIN.initApp()">
                <div class="am-center bottom-use">
                    <img id="homepage" src="images/bar/homepagel.png" alt="首页"/>
                    <span id="shouye" class="on-mine">首页</span>
                </div>
            </div>

            <div class="am-fl am-u-sm-4 am-text-center bottom-all" onclick="MAIN.shoppingCart()">
                <div class="am-center bottom-use">
                    <img id="shopcart" src="images/bar/shopcart.png" alt="购物车"/>
                    <span id="gouwuche">购物车</span>
                </div>
            </div>

            <div class="am-fl am-u-sm-4 am-text-center bottom-all" onclick="MAIN.mineInfo()">
                <div class="am-center bottom-use">
                    <img id="mine" src="images/bar/barcenter.png" alt="我的"/>
                    <span id="wode">我的</span>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="feature_info"></div>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="script/date/dateone.js"></script>
<script src="script/date/date.js"></script>
<script src="bower_components/seajs/dist/sea.js"></script>
<script src="bower_components/jweixin-1.1.0.js"></script>
<script src="bower_components/ejs.js"></script>
<script src="util.js"></script>
<script>
    var activityWidth = document.body.clientWidth;
    var activityHeight = document.body.clientHeight;
    window.localStorage["at_merchart_url"] = window.location.href;
    //用户登录判断
    //localStorage.clear();
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return r[2]; return null; //返回参数值
    }
    var user = window.localStorage["at_wx_user"];//at_wx_user
    //获取浏览器类型
    var ua = window.navigator.userAgent.toLowerCase();
//    user = {
//        // "id":'c3141442-c0e5-4f2f-bbda-4c0bf926afc6',//三国村
//        // "id":'b6669479-acb5-4cb5-b01b-efd6e0313261',//大江
//        "id":'c3141442-c0e5-4f2f-bbda-4c0bf926afc6',//火车来斯
//        // "id":'e2ba69d9-39ea-4d4d-a052-b1137a2821fe',//西递
//        "address": "安徽-宣城市-泾县",
//        "nickname": "Tomorrow",
//        "headurl": "http://antownimg.b0.upaiyun.com/atvillage/uploads/users/4e279c06-aa79-4e98-bde0-b5892fc207c7.jpg"
//    }
    var MAIN;
            var bowerclient;
    //         授权信息
            if(ua.indexOf('micromessenger') !=-1 ) {//微信
                var userid=getUrlParam("id");
                if(userid){
                    user={id:userid}
                    $.ajax({
                        type: "GET",
                        url: "/user/usermessage?userid="+user.id,
                        dataType: "json",
                        success: function (res) {
                            if((res.data[0].telephone!='' && res.data[0].description!='')){
                                $("#homepage").attr('src', "images/bar/homepagel.png");
                                $("#shopcart").attr('src', "images/bar/shopcart.png");
                                $("#mine").attr('src', "images/bar/barcenter.png");
                                $("#shouye").addClass("on-mine");
                                $("#gouwuche").removeClass("on-mine");
                                $("#wode").removeClass("on-mine");

                                $.get('/scenicspot/sceniclist', function (res) {
                                    seajs.use("/index", function (scenic) {
                                        $("#scenicbody").html(new EJS({url: "/views/scenicspot/sceniclist.ejs"}).render({
                                            datas: res.datas.rows1,
                                            datas2: res.datas.rows2
                                        }));
                                        MAIN = scenic;
                                    });
                                })
                            }else {
                                seajs.use('/index', function (login) {
                                    $('#scenicbody').html(new EJS({url: "views/login.ejs"}).render({

                                    }));
                                    MAIN=login;
                                })
                            }
                        }
                    });
                }else{
                    if (user && user != 'null') {
                        user = JSON.parse(user);
                        var timestamp = parseInt(window.localStorage['at_wx_time'] ? window.localStorage['at_wx_time'] : new Date().getTime());
                        var now = new Date().getTime();
                        // 大于 ? 天
                        if ((now - timestamp) / 86400000 > 1) {
                            window.localStorage["at_callback_url"] = window.location.href;
                            window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx538040febfc4cd83&redirect_uri=http%3a%2f%2fwww.eyou96001.com%2fweChat_callback%3fid%3dAT009%26tp%3dmerchart&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
                        }
                    } else {
                        window.localStorage["at_callback_url"] = window.location.href;
                        //授权登陆
                        window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx538040febfc4cd83&redirect_uri=http%3a%2f%2fwww.eyou96001.com%2fweChat_callback%3fid%3dAT009%26tp%3dmerchart&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
                    }
                }
                bowerclient='weixin';
                //查询 用户是否是关注用户
            }else{
                toast.show("暂不支持当前查看方式！！！");
                window.location.href="http://www.baidu.com";

            }

//    seajs.use('/index', function (main) {
//        MAIN = main;
//        MAIN.initApp();
//    });


</script>
</body>
</html>
